package com.crm.system.service.impl;

import java.util.List;
import com.crm.common.utils.DateUtils;
import com.crm.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.crm.system.mapper.BieMedicationMapper;
import com.crm.system.domain.BieMedication;
import com.crm.system.service.IBieMedicationService;
import com.crm.common.core.text.Convert;

/**
 * 用药情况Service业务层处理
 * 
 * @author crm
 * @date 2021-05-10
 */
@Service
public class BieMedicationServiceImpl implements IBieMedicationService 
{
    @Autowired
    private BieMedicationMapper bieMedicationMapper;

    /**
     * 查询用药情况
     * 
     * @param medicationId 用药情况ID
     * @return 用药情况
     */
    @Override
    public BieMedication selectBieMedicationById(String medicationId)
    {
        return bieMedicationMapper.selectBieMedicationById(medicationId);
    }

    /**
     * 查询用药情况列表
     * 
     * @param bieMedication 用药情况
     * @return 用药情况
     */
    @Override
    public List<BieMedication> selectBieMedicationList(BieMedication bieMedication)
    {
        return bieMedicationMapper.selectBieMedicationList(bieMedication);
    }

    /**
     * 新增用药情况
     * 
     * @param bieMedication 用药情况
     * @return 结果
     */
    @Override
    public int insertBieMedication(BieMedication bieMedication)
    {
        bieMedication.setMedicationId(UUID.randomUUID().toString());
        bieMedication.setCreateTime(DateUtils.getNowDate());
        return bieMedicationMapper.insertBieMedication(bieMedication);
    }

    /**
     * 修改用药情况
     * 
     * @param bieMedication 用药情况
     * @return 结果
     */
    @Override
    public int updateBieMedication(BieMedication bieMedication)
    {
        return bieMedicationMapper.updateBieMedication(bieMedication);
    }

    /**
     * 删除用药情况对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBieMedicationByIds(String ids)
    {
        return bieMedicationMapper.deleteBieMedicationByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用药情况信息
     * 
     * @param medicationId 用药情况ID
     * @return 结果
     */
    @Override
    public int deleteBieMedicationById(String medicationId)
    {
        return bieMedicationMapper.deleteBieMedicationById(medicationId);
    }
}
